/*
 * CUDAAESEncrypter.h
 *
 *  Created on: Jun 23, 2010
 *      Author: lukasz
 */

#ifndef CUDAAESENCRYPTER_H_
#define CUDAAESENCRYPTER_H_

#ifndef AESENCRYPTER_H_
#include "Encrypter.h"
#endif

#include <exception>
#include <string>

class CudaMemoryManager;

class CUDAAESEncrypter: public AESEncrypter
{
public:
	CUDAAESEncrypter(BigInteger& init_vector, byte* key);
	virtual ~CUDAAESEncrypter();

	virtual void* encrypt(const void* inbuffer, uint32_t size, uint32_t nr);
	virtual void* decrypt(const void* buffer, uint32_t size, uint32_t nr);

private:
	void allocDeviceIVMemory(uint32_t size);
	CudaMemoryManager* d_cuMem;
	uint32_t* deviceMemExpandedKey;
	byte* host_IVMemory;
	byte* device_IVMemory;
	uint32_t deviceIVmemorySize;
};



#endif /* CUDAAESENCRYPTER_H_ */
